package com.lhg.pattern.structural.adapter;

public class MediaAdapter implements MediaPlayer{

    AdvancedMediaPlayer advancedMusicPlayer;

    public MediaAdapter(String audioType) {
        if ("mp4".equalsIgnoreCase(audioType)){
            advancedMusicPlayer=new Mp4Player();
        }else if("vlc".equalsIgnoreCase(audioType)){
            advancedMusicPlayer=new VlcPlayer();
        }
    }

    @Override
    public void play(String audioType, String fileName) {
        if ("mp4".equalsIgnoreCase(audioType)){
            advancedMusicPlayer.playMp4(fileName);
        }else if("vlc".equalsIgnoreCase(audioType)){
            advancedMusicPlayer.playVlc(fileName);
        }
    }
}
